package bTree.LeetCode;

public class 破坏回文串 {
    public String breakPalindrome(String palindrome) {
        int length = palindrome.length();
        if (length==1){
            return "";
        }
        StringBuilder sb=new StringBuilder(palindrome);
        for (int i = 0; i < length/2; i++) {
            char c = sb.charAt(i);
            if (c!='a') {
                sb.replace(i, i + 1, "a");
                return sb.toString();
            }
        }
        sb.replace(length-1, length, "b");
        return sb.toString();
    }
}